import { dayjs } from "element-plus";

export const contactInfo = {
  customer_name: "",
  mobile_code: ""
};

export const allocationTransferForm = {
  roleId: "",
  deptId: "",
  deptName: "",
  userId: "",
  userName: "",
  customerIds: [],
  type: 1,
  portaintId: ""
};

/**
 * 分配移交
 */
export const allocationTransferType = {
  ALLOCATION: 1, // 分配
  TRANSFER: 2 // 移交
};

export const conditionTypes = {
  TextInput: [
    // {
    //   label: "包含",
    //   value: "IN",
    //   cmp: "MultipleSelect"
    // },
    {
      label: "模糊匹配",
      value: "LIKE",
      cmp: "TextInput"
    },
    {
      label: "等于",
      value: "EQ",
      cmp: "TextInput"
    },
    {
      label: "为空",
      value: "isNull",
      cmp: "TextInput"
    },
    {
      label: "不为空",
      value: "isNotNull",
      cmp: "TextInput"
    }
  ],
  NumberInput: [
    {
      label: "等于",
      value: "EQ",
      cmp: "NumberInput"
    },
    {
      label: "小于",
      value: "LT",
      cmp: "NumberInput"
    },
    {
      label: "小于等于",
      value: "LE",
      cmp: "NumberInput"
    },
    {
      label: "大于",
      value: "GT",
      cmp: "NumberInput"
    },
    {
      label: "大于等于",
      value: "GE",
      cmp: "NumberInput"
    },
    {
      label: "x ＜ 值 ＜ Y",
      value: "GTLT",
      cmp: "NumberInputRange"
    },
    {
      label: "x ≤ 值 ＜ Y",
      value: "GELT",
      cmp: "NumberInputRange"
    },
    {
      label: "x ＜ 值 ≤ Y",
      value: "GTLE",
      cmp: "NumberInputRange"
    },
    {
      label: "为空",
      value: "isNull",
      cmp: "NumberInput"
    },
    {
      label: "不为空",
      value: "isNotNull",
      cmp: "NumberInput"
    }
  ],
  DateTime: [
    {
      label: "等于",
      value: "EQ",
      cmp: "DateTime"
    },
    {
      label: "介于",
      value: "Between",
      cmp: "DateTime"
    },
    {
      label: "动态日期",
      value: "Dynamic",
      cmp: "DateTime"
    },
    {
      label: "为空",
      value: "isNull"
    },
    {
      label: "不为空",
      value: "isNotNull"
    }
  ],
  SelectInput: [
    // {
    //   label: "包含",
    //   value: "IN",
    //   cmp: "MultipleSelect"
    // },
    {
      label: "等于",
      value: "IN"
    },
    {
      label: "为空",
      value: "isNull"
    },
    {
      label: "不为空",
      value: "isNotNull"
    }
  ],
  MultipleSelect: [
    {
      label: "包含",
      value: "IN"
    },
    {
      label: "为空",
      value: "isNull"
    },
    {
      label: "不为空",
      value: "isNotNull"
    }
  ],
  CascaderInput: [
    {
      label: "等于",
      value: "EQ"
    },
    {
      label: "为空",
      value: "isNull"
    },
    {
      label: "不为空",
      value: "isNotNull"
    }
  ],
  UserPicker: [
    // {
    //   label: "包含",
    //   value: "IN",
    //   cmp: "MultipleSelect"
    // },
    {
      label: "模糊匹配",
      value: "LIKE",
      cmp: "UserPicker"
    }
  ]
};

// number
export const inputCompare = ["EQ", "LT", "LE", "GT", "GE", "isNull", "isNotNull"];
export const rangeCompare = ["GTLT", "GELT", "GTLE", "GELE"];

// text
export const textCompare = ["EQ", "LIKE", "isNull", "isNotNull"];
export const textCompareRange = ["IN"];

//动态日期下拉选项
export const dynamicOptions = [
  { label: "今天", value: "toDay" },
  { label: "昨天", value: "toYesterday" },
  { label: "本周", value: "toWeek" },
  { label: "本月", value: "toMonth" }
];

//人员
export const userCompare = ["LIKE"];

/**
 * 日期 快捷选项
 */
export const getNowDate = () => {
  const start = `${dayjs().format("YYYY-MM-DD")} 00:00:00`;
  const end = `${dayjs().format("YYYY-MM-DD")} 23:59:59`;
  return [start, end];
};
export const getYesterday = () => {
  const now = new Date();
  const yesterday = new Date(now.getFullYear(), now.getMonth(), now.getDate() - 1);
  const start = `${dayjs(yesterday).format("YYYY-MM-DD")} 00:00:00`;
  const end = `${dayjs(yesterday).format("YYYY-MM-DD")} 23:59:59`;
  return [start, end];
};
export const getNowWeek = () => {
  const now = new Date();
  const startOfWeek = new Date(now.getFullYear(), now.getMonth(), now.getDate() - now.getDay() + 1);
  const endOfWeek = new Date(now.getFullYear(), now.getMonth(), now.getDate() - now.getDay() + 7);
  const start = `${dayjs(startOfWeek).format("YYYY-MM-DD")} 00:00:00`;
  const end = `${dayjs(endOfWeek).format("YYYY-MM-DD")} 23:59:59`;
  return [start, end];
};
export const getNowMonth = () => {
  const now = new Date();
  const startOfMonth = new Date(now.getFullYear(), now.getMonth(), 1);
  const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0);
  const start = `${dayjs(startOfMonth).format("YYYY-MM-DD")} 00:00:00`;
  const end = `${dayjs(endOfMonth).format("YYYY-MM-DD")} 23:59:59`;
  return [start, end];
};
export const pickerTimeShortcuts = [
  {
    text: "今日",
    value: getNowDate
  },
  {
    text: "昨日",
    value: getYesterday
  },
  {
    text: "本周",
    value: getNowWeek
  },
  {
    text: "本月",
    value: getNowMonth
  }
];

export const filterType = {
  FIXED_COLUMN_BUTTON: "1", //  固定列按钮
  GROUP_BUTTON: "2", //  分组按钮
  CUSTOMER_TYPE: "3", //客户类型
  RESPONSIBLE_PERSON: "4", //负责人
  UNALLOCATED: "5", //未分配
  CUSTOM_QUERY: "6" // 自定义查询
};

export const tableBody = {
  // 1固定列按钮 2分组按钮
  groupType: filterType.FIXED_COLUMN_BUTTON,
  customerGroupId: "0",
  // 3.客户类型搜索 4.负责人
  searchType: filterType.CUSTOMER_TYPE,
  searchValue: "",
  // 5 未分配
  unallocatedType: "",
  unallocatedValue: "",
  // 6 自定义查询
  customType: "",
  customValue: "",
  // 是否查询流失客户
  lost: false
};

/**
 * 客户状态
 */
export const clientStatus = {
  PENDING: 0, // 待处理
  PROCESSING: 1, //处理中
  ARCHIVED: 2, //已归档
  LOST: 3 //已流失
};

/**
 * 预览图片/视频格式
 */
export const previewVideoType = ["avi", "mov", "mp4", "wmv"];
export const previewImgType = [
  "svgz",
  "pjp",
  "png",
  "ico",
  "avif",
  "tiff",
  "tif",
  "jfif",
  "svg",
  "xbm",
  "pjpeg",
  "webp",
  "jpg",
  "jpeg",
  "bmp",
  "gif"
];
